package whackEm.ui;

import whackEm.V2.WhackEmPanel;
import android.graphics.Bitmap;
import android.graphics.Canvas;

public class PauseButton {

	Bitmap button;	
	public float top,left,height,width;
	private WhackEmPanel panel;
	
	
	public PauseButton(Bitmap buttonBitmap,float scale,WhackEmPanel panel) {
		this.button = buttonBitmap;
		this.panel = panel;
		height =  panel.convertYforDrawable(buttonBitmap.getHeight());
		width =  panel.convertXforDrawable(buttonBitmap.getWidth());
		setPosition(scale);
	
	}
	
	public void setPosition(float scale) {
		top = panel.convertY((800 -10)) - height ;
		left = panel.convertX((480 - 10)) -width;
		
	}
	
	
	public void update() {
		
	} 
	
	public void draw(Canvas canvas) {
		canvas.drawBitmap(button, left, top, null);
		
	} 
	
	public void handleActionDown(float x,float y) {
		if (y >= top && x >= left)
			if (y <= top + height && x<= left + width)
     			panel.pauseGame();
		
	} 
	
}
